Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port to GNOME 3.34 #21

Draft
wants to merge 3 commits into
base: feat-ES6-porting
Choose a base branch
from

Conversation

jtojnar
Copy link

@jtojnar jtojnar commented Oct 10, 2019

I can now use the extension successfully on GNOME 3.34. There are still some bugs to work out, though:

  • In “hide-and-seek” mode, moving a mouse cursor over the preview
  • There is a ton of messages like the following in the journal. Memory management issues?
    Attempting to call back into JSAPI during the sweeping phase of GC. This is most likely caused by not destroying a Clutter actor or Gtk+ widget with ::destroy signals connected, but can also be caused by using the destroy(), dispose(), or remove() vfuncs. Because it would crash the application, it has been blocked and the JS callback not invoked. The offending signal was destroy on Gjs_ExtensionRow 0x2ea3600.
  • Data flow causes event handler cycles. For now, I have disabled the snapping which reduces it somewhat but the handlers are still called few too many times.

Does anyone have an idea how to solve these?

What has been done

I had to accomodate the following GNOME Shell changes:

Additionally:

  • Changed the supported GNOME Shell versions to 3.34, as maintaining backwards compatibility would be too much work.
  • Removed fallbacks since we do not support GNOME ≤ 3.34 any more.

Classes & arrow functions.

Tested on GNOME 3.32.

Classes need to be overridden with vars to avoid the
“That property was defined with 'let' or 'const' inside the module.”
warning.
I had to accomodate the following GNOME Shell changes:
* Slider switched to value property instead of methods. (https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/666)
* Widgets themselves now inherit from actors. (https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/487)
* Popup menu is GObject.Class so it cannot use constructor. (https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/499)
* MetaShapedTexture no longer has get_size method, nor it can be cloned. (https://gitlab.gnome.org/GNOME/mutter/merge_requests/409)

Additionally:
* Changed the supported GNOME Shell versions to 3.34, as maintaining backwards compatibility would be too much work.
* Removed fallbacks since we do not support GNOME ≤ 3.34 any more.
@jtojnar
Copy link
Author

jtojnar commented Oct 10, 2019

Perhaps it would be a good idea to convert all the listeners and emits to GObject properties connected together with GBinding. Hopefully, GLib is smart enough to not cycle.

Unfortunately, the data flows throughout almost all the modules so we would need to duplicate the properties everywhere.

graph

I tried the following but apparently G_MINDOUBLE is not exposed to JavaScript.

var PopupSliderMenuItem = GObject.registerClass({
    Properties: {
        'value': GObject.ParamSpec.double(
            'value', 'value', 'value',
            GObject.ParamFlags.READWRITE,
            GLib.MINDOUBLE, GLib.MAXDOUBLE, 0,
    },
}, class PopupSliderMenuItem extends PopupMenu.PopupBaseMenuItem {
    
        this.slider.bind_property_full(
            'value',
            this,
            'value',
            GObject.BindingFlags.BIDIRECTIONAL,
            (value) => deNormalizeRange(value, this.min, this.max, this.step),
            (value) => normalizeRange(value, this.min, this.max, this.step)
        );

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant